/**
 * File InformationAgent.java created by Pablo Díaz Fernández
 * on 28/10/2011 for the project supply-chain-simulator
 */
package org.lsk.pfc.scsim.model.agent;

import jade.core.Agent;

import org.lsk.pfc.scsim.model.behaviour.InformationAgentCB;
import org.lsk.pfc.scsim.model.persistence.dao.impl.NeedDAO;
import org.lsk.pfc.scsim.model.persistence.dao.impl.RequestDAO;
import org.lsk.pfc.scsim.model.persistence.dao.impl.StockDAO;
import org.lsk.pfc.scsim.model.util.ApplicationContextProvider;

/**
 * @author Pablo Díaz Fernández
 * 
 */
public final class InformationAgent extends Agent {

	/**
	 * Serial version ID.
	 */
	private static final long serialVersionUID = 5029851801692551369L;

	/**
	 * MAS name.
	 */
	private String masName;

	/**
	 * DAO for {@link NeedDTO}.
	 */
	private NeedDAO needDAO;
	/**
	 * DAO for {@link StockDTO}.
	 */
	private StockDAO stockDAO;
	/**
	 * DAO for {@link RequestDTO}.
	 */
	private RequestDAO requestDAO;

	/**
	 * @see jade.core.Agent#setup()
	 */
	@Override
	protected void setup() {
		masName = (String) super.getArguments()[0];
		needDAO = ApplicationContextProvider.getContext()
		        .getBean(NeedDAO.class);
		stockDAO = ApplicationContextProvider.getContext().getBean(
		        StockDAO.class);
		requestDAO = ApplicationContextProvider.getContext().getBean(
		        RequestDAO.class);
		addBehaviour(new InformationAgentCB());
	}

	/**
	 * Gets the masName.
	 * 
	 * @return the masName
	 */
	public String getMasName() {
		return masName;
	}

	/**
     * Gets the needDAO.
     *
     * @return the needDAO
     */
    public NeedDAO getNeedDAO() {
    	return needDAO;
    }

	/**
     * Gets the stockDAO.
     *
     * @return the stockDAO
     */
    public StockDAO getStockDAO() {
    	return stockDAO;
    }

	/**
     * Gets the requestDAO.
     *
     * @return the requestDAO
     */
    public RequestDAO getRequestDAO() {
    	return requestDAO;
    }
}
